home *** CD-ROM | disk | FTP | other *** search
- Path: anvil.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.pl1,comp.lang.c
- Subject: Re: PL/I and C
- Date: 27 Feb 1996 15:55:38 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4h05lqINNh1t@anvil.ugrad.cs.ubc.ca>
- References: <4gh5ru$eng@goanna.cs.rmit.EDU.AU> <AD536AAB9668B76CD@mcdialb09.it.luc.edu> <312E363C.3CDE@corp.dialog.com> <AD53AB1396681879FA@mcdialb10.it.luc.edu>
- NNTP-Posting-Host: anvil.ugrad.cs.ubc.ca
-
- In article <AD53AB1396681879FA@mcdialb10.it.luc.edu>,
- Verne Arase <VArase@varase.it.luc.edu> wrote:
- >In article <312E363C.3CDE@corp.dialog.com>,
- >Paul Gorodyansky <paul_gorodyansky@corp.dialog.com> wrote:
- >
- > >Sorry, you missed my point. If I want to have SEVERAL masks for THE SAME
- > >area of memory, that is have SEVERAL DIFFERENT Structures overlaid my
- > >buffer, C has a feature for this - a Union, where I can have members of
- > >different Nature overlaid the same area of memory, BUT, unlike PL/I, an
- > >Array CAN NOT be a member of a Union. But, it is always a case in our
- > >Text Processing - I want to look at my source record's buffer at some
- >
- >Huh? Why not? I know of no rule which would preclude having an array in a
- >union.
-
- Maybe he means a dynamically allocated piece of storage which is analogous to a
- variable-length array.
-
- >... and BTW, you don't need to use a union; you can simply have several
- >pointers, each containing the same address. Just coerce them with a cast.
- >
- > foo *x;
- > bar *y;
- >
- > y=(bar *) x;
-
- This is not allowed. A pointer may be converted to a void * object and back
- _to_the_same_pointer_type_ with full recovery of the pointer. That is all that
- is guaranteed. The void * object is not really a pointer at all (conceptually),
- just a catch-all bit bucket that can hold any pointer value without loss.
-
- There is no need at all for what you are doing in a carefully constructed
- program.
- --
-
-